﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LantingConnect.DBModel;
using LantingConnect.View;
using System.Threading;

namespace LantingConnect.Controller
{
   public  class Controller_Index
    {
        #region 全局变量、常量
        public static List<t_icitem> icitemList = new List<t_icitem>();
        public IcitemHelper icitemHelper = new IcitemHelper();
        public SEOrderHelper seOrderHelper = new SEOrderHelper();

        //窗体
        public Form_Index form_index;
        //获取对应窗体对象
        public Form_Index Get_form_index
        {
            get
            {
                if (form_index == null || form_index.IsDisposed)
                {
                    form_index = new Form_Index();
                    form_index.controller_index = this;
                }
                return form_index;
            }
        }



        #endregion

        #region 定义单例
        private static Controller_Index instance;
        public static Controller_Index Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new Controller_Index();
                }
                return instance;
            }
        }
       
        #endregion

        #region 控制器构造函数
        public Controller_Index()
        {
            Get_form_index.controller_index = this;
        }
        #endregion

        #region 控制器构造函数
        public Controller_Index(Form_Index _form)
        {
            form_index = _form;
            form_index.controller_index = this;
        }
        #endregion

        #region 外部方法-获取所有
        public void Function_getAllIcitemList(int opsPageNo, int pageSize, int total, string key)
        {
            Dictionary<string, string> mparams = new Dictionary<string, string>();
            mparams.Add("pageNo", opsPageNo.ToString());
            mparams.Add("pageSize", pageSize.ToString());
            mparams.Add("total", total.ToString());
            mparams.Add("key", key);
            Thread thread = new Thread(new ParameterizedThreadStart(icitemHelper.SearchByKey));
            thread.Start(mparams);
        }
        #endregion

        #region 外部方法-获取所有
        public void Function_getAllSEOrderList(int opsPageNo, int pageSize, int total, string key)
        {
            Dictionary<string, string> mparams = new Dictionary<string, string>();
            mparams.Add("pageNo", opsPageNo.ToString());
            mparams.Add("pageSize", pageSize.ToString());
            mparams.Add("total", total.ToString());
            mparams.Add("key", key);
            Thread thread = new Thread(new ParameterizedThreadStart(seOrderHelper.SearchByKey));
            thread.Start(mparams);
        }
        #endregion
    }
}
